package com.yashi.springmvcjbpm.util;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

import org.jbpm.api.model.OpenExecution;
import org.jbpm.api.task.Assignable;
import org.jbpm.api.task.AssignmentHandler;

public class AssignTaskManager implements AssignmentHandler {

	private static final long serialVersionUID = 1L;

	@Override
	public void assign(Assignable assignable, OpenExecution execution) throws Exception {
		String sql= "select * from staff where staffPosition='manager'";
		GetConnection getConnection = new GetConnection();
		Connection con=getConnection.getCon();
		Statement st = con.createStatement();
		ResultSet rs = st.executeQuery(sql);
		while(rs.next()){
			
			// 设置流程处理（受理）人
			assignable.setAssignee(rs.getString("staffName"));
		}
	}

}